﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AnimalSimulatorBasics
{
    class AnimalFactory
    {
        public Animal[] Produce(uint noOfAnimals)
        {
            var random = new Random();
            var animals = new Animal[noOfAnimals];

            for (int i = 0; i < noOfAnimals; i++)
            {
                if (random.Next(1) == 1)
                    animals[i] = new Herbivore("Herbivore" + i, random.Next(5000));
                else
                    animals[i] = new Carnivore("Lion", 400);
            }

            return animals;
        }
    }

    class Square
    {
        private List<Animal> AnimalsOnSquare;
            
        public Square()
        {
            AnimalsOnSquare = new List<Animal>();
        }

        public void AddAnimals()
        {
            var animalFactory = new AnimalFactory();
            Animal[] animals;

            animals = animalFactory.Produce(10);


            for (int i = 0; i < animals.Count(); i++)
            {
                AnimalsOnSquare.Add(animals[i]);
            }
        }
    }
}
